--- system.mk.orig	2008-02-07 09:21:04.000000000 -0600
+++ system.mk	2008-02-07 09:21:28.000000000 -0600
@@ -8,25 +8,25 @@
 
 # Installation path prefix. Unless you know what you're doing, the default
 # of /usr/local is likely the correct choice.
-PREFIX=/usr/local
+PREFIX=/usr
 
 # Unless you are creating a package conforming to some OS's standards, you
 # probably do not want to modify the following directories:
 
 # Main binaries
-BINDIR=$(PREFIX)/bin
+BINDIR=$(DESTDIR)$(PREFIX)/bin
 # Configuration .lua files
-ETCDIR=$(PREFIX)/etc/ion3
+ETCDIR=$(DESTDIR)/etc/X11/ion3
 # Some .lua files and ion-* shell scripts
-SHAREDIR=$(PREFIX)/share/ion3
+SHAREDIR=$(DESTDIR)$(PREFIX)/share/ion3
 # Manual pages
-MANDIR=$(PREFIX)/share/man
+MANDIR=$(DESTDIR)$(PREFIX)/man
 # Some documents
-DOCDIR=$(PREFIX)/share/doc/ion3
+DOCDIR=$(DESTDIR)$(PREFIX)/doc/ion$(DOCVER)
 # Nothing at the moment
-INCDIR=$(PREFIX)/include/ion3
+INCDIR=$(DESTDIR)$(PREFIX)/include/ion3
 # Nothing at the moment
-LIBDIR=$(PREFIX)/lib
+LIBDIR=$(DESTDIR)$(PREFIX)/lib
 # Modules
 MODULEDIR=$(LIBDIR)/ion3/mod
 # Compiled Lua source code
@@ -36,7 +36,7 @@
 # For ion-completeman system-wide cache
 VARDIR=/var/cache/ion3
 # Message catalogs
-LOCALEDIR=$(PREFIX)/share/locale
+LOCALEDIR=$(DESTDIR)$(PREFIX)/share/locale
 
 # Executable suffix (for Cygwin).
 #BIN_SUFFIX = .exe
@@ -62,7 +62,7 @@
 
 # If you have installed Lua 5.1 from the official tarball without changing
 # paths, this should do it.
-LUA_DIR=/usr/local
+LUA_DIR=/usr
 LUA_LIBS = -L$(LUA_DIR)/lib -llua
 LUA_INCLUDES = -I$(LUA_DIR)/include
 LUA=$(LUA_DIR)/bin/lua
@@ -81,7 +81,7 @@
 ##
 
 # Paths
-X11_PREFIX=/usr/X11R6
+X11_PREFIX=/usr
 # SunOS/Solaris
 #X11_PREFIX=/usr/openwin
 
@@ -157,7 +157,7 @@
 	-Wtrigraphs -Wformat -Wchar-subscripts \
 	-Wparentheses -pedantic -Wuninitialized
 
-CFLAGS=-Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
+CFLAGS=-g $(WARN) $(DEFINES) $(EXTRA_INCLUDES) $(INCLUDES) $(SLKCFLAGS)
 LDFLAGS=$(LIBS) $(EXTRA_LIBS)
 EXPORT_DYNAMIC=-Xlinker --export-dynamic
 
